package org.zfes.snowier.zbss.xzy.router.message;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.message.model.Message;
import org.zfes.snowier.zbss.xzy.biz.message.service.IMessageService;
import org.zfes.snowier.core.data.SelectVo;
@Controller("org.zfes.snowier.zbss.xzy.router.message.MessageController")
@RequestMapping("manger/message")
public class MessageController implements BaseController {

	
	@Autowired
	private IMessageService messageService;
	
	//@RequiresPermissions(value="message:loadMessageDataSet",desc="消息记录列表")
    @RequestMapping(value="/loadMessageDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMessageDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  messageService.loadMessageDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	
	//@RequiresPermissions(value="message:loadMessage",desc="消息记录加载")
    @RequestMapping(value="/loadMessage/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMessage(@PathVariable("id")Long id){
		Optional<Message> ops = messageService.loadMessageById(id);
		return ajaxQuery("message",ops);
    }
	
	//@RequiresPermissions(value="message:deletMessage",desc="消息记录删除")
    @RequestMapping(value="/deleteMessage/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteMessage(@PathVariable("id")Long id){
		messageService.deleteMessage(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }
    
}